package com.example.exersice;

import com.sun.org.apache.xpath.internal.SourceTree;

import java.io.IOException;
import java.util.Scanner;

/**
 * Created by venus on 11/09/14.
 */
public class DrawHorizontalLine {
    public static void main(String[] args) {

        System.out.println("How many asterisks would you like? (Please enter a number) ");
        int numberOfAsterisks;
        String lineOfAsterisks = "";

        //Read number of asterisks
        Scanner input = new Scanner(System.in);

        //Check if the number is valid
        try {
            numberOfAsterisks = input.nextInt();
        } catch (Exception e) {
            System.out.println("Wrong number. Please try again.");
            return;
        }

        //printout number of asterisks
        for (int i = 0; i < numberOfAsterisks; i++) {
            lineOfAsterisks += "*";
        }
        System.out.println(lineOfAsterisks);
    }
}
